<?php $this->load->view('admin/public/head.html', array('css' => array(
    '/assets/admin/css/admin/common.css'
))); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper baseAdmin" ng-controller="base-farm-index">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            基地管理
            <small>商家信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 基地管理</a></li>
            <li class="active">基地列表</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <!-- Your Page Content Here -->
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">基地列表</h3>
                        <div class="box-tools">
                            <div class="input-group input-group-sm">
                                <a href="/farm/base/add" style="background: #00a65a; border: none;" class="btn btn-sm btn-info"><i class="fa fa-plus"></i> 添加基地</a>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered">
                            <tr>
                                <th class="text-center" style="width: 40px">#</th>
                                <th class="text-center" style="width: 120px;">图片</th>
                                <th>基地名称</th>
                                <th class="text-center">负责人</th>
                                <th class="text-center">联系电话</th>
                                <th class="text-center">添加时间</th>
                                <th class="text-center">直播</th>
                                <th class="text-center">首页显示</th>
                                <th class="text-center">状态</th>
                                <th class="text-center" style="width: 80px">操作</th>
                            </tr>
                            <?php if(!empty($data)):?>
                            <?php foreach($data as $item):?>
                            <tr>
                                <td class="text-center"><?=$item['id']?></td>
                                <td class="text-center">
                                    <img src="<?=thumb($item['thumb'], 100, 60)?>" onerror="this.src='/assets/admin/img/nothumb.png'" class="base-thumb">
                                </td>
                                <td><a href="/farm/base/edit?baseId=<?=$item['id']?>"><?=$item['name']?></a></td>
                                <td class="text-center"><?=$item['charger']?></td>
                                <td class="text-center"><?=$item['phone']?></td>
                                <td class="text-center"><?=$item['created']?></td>
                                <td class="text-center">
                                    <?php if($item['streamId'] != 0):?>
                                        <span class="text-green">开启</span>
                                    <?php else: ?>
                                        <span class="text-red">未开启</span>
                                    <?php endif;?>
                                </td>
                                <td class="text-center">
                                    <?php if ($item['isShow']):?>
                                    <span class="text-green">是</span>
                                    <?php else:?>
                                    <span class="text-red">否</span>
                                    <?php endif;?>
                                </td>
                                <td class="text-center">
                                    <?php if ($item['status']):?>
                                    <span class="badge bg-green">正常</span>
                                    <?php else:?>
                                    <span class="badge bg-green">关闭</span>
                                    <?php endif;?>
                                </td>
                                <td class="text-center">
                                    <a href="/farm/base/edit?baseId=<?=$item['id']?>" class="btn btn-xs btn-link"><i class="fa fa-pencil"></i> 编辑</a>
                                    <?php if($item['id'] > 0):?>
                                    <a href="javascript:void(0);" ng-click="deleteBase(<?=$item['id']?>)" class="btn btn-xs btn-link"><i class="fa fa-close"></i> 删除</a>
                                    <?php endif;?>
                                </td>
                            </tr>
                            <?php endforeach; ?>
                            <?php else:?>
                            <tr>
                                <td colspan="10"><p class="help-block text-center">
                                    暂无数据
                                </p></td>
                            </tr>
                            <?php endif;?>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <?=$page?>
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', ['js' => [
    '/assets/admin/js/base/base.js'
]]); ?>
